//
//  String+Extension.swift
//  ZHLEE_Blog_Swift_Pro
//
//  Created by ZHLEEBlander on 15/10/17.
//  Copyright © 2015年 ZHLEEBlander. All rights reserved.
//

import Foundation
import UIKit

extension String{

    func size(font:UIFont,constrainedToSize:CGSize = CGSizeZero)->CGSize{
    
        
        let string = self as NSString
        
//        初始化属性
        let arrt = [
        
            NSFontAttributeName: font
        ]
        
        return string.boundingRectWithSize(constrainedToSize, options: [NSStringDrawingOptions.UsesLineFragmentOrigin], attributes: arrt, context: nil).size
    }
}
